<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="zh">
<head>
    <title>${requestScope.course.cname}|河海大学实践课程考勤系统</title>
    <jsp:include page="head.jsp"/>
    <script>
        function refreshVerifyCode() {
            document.getElementById("vcode").src = "${pageContext.request.contextPath}/checkCodeServlet?time=" + new Date().getTime();
        }

        function check() {
            var msg = document.getElementById("msg");
            if (document.getElementById("verifycode").value === "") {
                msg.innerText = "验证码不能为空！";
                return false;
            }
            return true;
        }
    </script>
</head>
<body>
<div class="container">
    <jsp:include page="header.jsp"/>
    <div class="row">
        <div class="col-sm-offset-1 col-sm-2">
            <ul class="nav nav-pills nav-stacked">
                <li><a href="${pageContext.request.contextPath}/teacher/index">主页</a></li>
                <li><a href="${pageContext.request.contextPath}/teacher/info">个人信息</a></li>
                <li><a href="${pageContext.request.contextPath}/teacher/addcourse">添加课程</a></li>
                <li><a href="${pageContext.request.contextPath}/teacher/logout">退出登录</a></li>
            </ul>
        </div>
        <div class="col-sm-offset-1 col-sm-6">
            <h3>课程名称：${requestScope.course.cname}</h3>
            <a class="btn btn-default btn-block"
               href="${pageContext.request.contextPath}/teacher/student?cid=${requestScope.course.cid}">学生管理</a>
            <a class="btn btn-default btn-block"
               href="${pageContext.request.contextPath}/teacher/task?cid=${requestScope.course.cid}">签到任务管理</a>
            <a class="btn btn-default btn-block"
               href="${pageContext.request.contextPath}/teacher/query?cid=${requestScope.course.cid}">学生签到信息查询</a>
            <a class="btn btn-default btn-block"
               href="${pageContext.request.contextPath}/teacher/print?cid=${requestScope.course.cid}">打印二维码</a>
            <hr>
            <h4 class="text-center text-danger">删除课程</h4>
            <form class="form-horizontal"
                  action="${pageContext.request.contextPath}/teacher/course?cid=${requestScope.course.cid}"
                  method="post" onsubmit="return check()">
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="verifycode">验证码</label>
                    <div class="col-sm-7">
                        <input id="verifycode" class="form-control" name="verifycode" type="text"
                               maxlength="4" placeholder="输入验证码以确认删除">
                    </div>
                    <div class="col-sm-3">
                        <a href="javascript:refreshVerifyCode();">
                            <img alt="验证码" id="vcode" class="img-responsive"
                                 src="${pageContext.request.contextPath}/checkCodeServlet"
                                 title="点击刷新">
                        </a>
                    </div>
                </div>
                <p id="msg" class="text-danger text-center">${requestScope.msg}</p>
                <input class="btn btn-block btn-danger" type="submit" value="删除课程">
            </form>
        </div>
    </div>
    <jsp:include page="footer.jsp"/>
</div>
</body>
</html>
